﻿<%@ WebHandler Language="C#" Class="getTabsite" %>

using System;
using System.Web;

public class getTabsite : IHttpHandler {
    
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        //骗人网站
        System.Text.StringBuilder rtnstr = new System.Text.StringBuilder();
        System.Data.DataSet dssite = new System.Data.DataSet();
        System.Data.DataSet dssitem = new System.Data.DataSet();
        result rs = new result();
        rs.fillDown(dssite, "3");
        rtnstr.Append("<tr>");
        rtnstr.Append("<th scope='col'>&nbsp;</th>");
        rtnstr.Append("<th class='gvthtCSS gvthcCSS gvctgCSS' align='left' scope='col'>问题  	[ 标签 ]</th>");
        rtnstr.Append("<th class='gvthtCSS gvthcCSS gvcpCSS' align='left' scope='col'>作者</th>");
        rtnstr.Append("<th class='gvthcCSS gvcnCSS' align='center' scope='col'>");
        rtnstr.Append("<img src='img/column_point_grey.gif' style='border-width:0px;' alt='' /></th>");
        rtnstr.Append("<th class='gvthcCSS gvcnCSS' align='center' scope='col'>");
        rtnstr.Append("<img src='img/column_reply_grey.gif' style='border-width:0px;' alt='' /></th>");
        rtnstr.Append("<th class='gvthcCSS gvcnCSS' align='left' scope='col'>");
        rtnstr.Append("<img src='img/column_time_grey.gif' style='border-width:0px;' alt='' /></th>");
        rtnstr.Append("</tr>");
        if (dssite.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < dssite.Tables[0].Rows.Count; i++)
            {
                rtnstr.Append("<tr>");
                rtnstr.Append("<td class='paddingCSS gvicoCSS'>");
                rtnstr.Append("<img src='img/topic_open.gif' width='14px' height='14px' alt='' />");
                rtnstr.Append("</td>");
                rtnstr.Append("<td class='paddingCSS gvctgCSS'><a href='page.aspx?id=");
                rtnstr.Append(dssite.Tables[0].Rows[i]["id"].ToString());
                rtnstr.Append("'>");
                rtnstr.Append(dssite.Tables[0].Rows[i]["title"].ToString());
                rtnstr.Append("</a></td>");
                rtnstr.Append("<td class='paddingCSS gvcpCSS'>");
                rtnstr.Append(dssite.Tables[0].Rows[i]["insertuser"].ToString());
                rtnstr.Append("</td><td class='paddingCSS gvcnCSS'>");
                rtnstr.Append("0");
                rtnstr.Append("</td><td class='paddingCSS gvcnCSS'>");
                rs.fillMsg(dssitem, dssite.Tables[0].Rows[i]["id"].ToString());
                if (dssitem.Tables[0].Rows.Count > 0)
                {
                    rtnstr.Append(dssitem.Tables[0].Rows.Count.ToString());
                }
                else
                {
                    rtnstr.Append("0");
                }
                rtnstr.Append("</td><td>");
                if (dssite.Tables[0].Rows[i]["mtime"].ToString() == string.Empty)
                {
                    rtnstr.Append(dssite.Tables[0].Rows[i]["inserttime"].ToString().Split(' ')[0].ToString());
                }
                else
                {
                    rtnstr.Append(dssite.Tables[0].Rows[i]["mtime"].ToString().Split(' ')[0].ToString());
                }
                rtnstr.Append("</td></tr>");
            }
        }
        context.Response.Write("[{value:\"" + rtnstr.ToString() + "\"}]");
    }    
    public bool IsReusable {
        get {
            return false;
        }
    }

}